home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Toolbox
/
Visual Basic Toolbox (P.I.E.)(1996).ISO
/
hlp_auth
/
tagit
/
fade.bas
< prev
next >
Wrap
BASIC Source File
|
1993-12-09
|
2KB
|
46 lines
Option Explicit
' Data type used by FillRect
Type RECT
Left As Integer
Top As Integer
Right As Integer
Bottom As Integer
End Type
' API Functions used to create solid brush and draw brush on form
Declare Function CreateSolidBrush Lib "GDI" (ByVal crColor As Long) As Integer
Declare Function FillRect Lib "User" (ByVal hDC As Integer, lpRect As RECT, ByVal hBrush As Integer) As Integer
Declare Function DeleteObject Lib "GDI" (ByVal hObject As Integer) As Integer
Dim hBrush%
Sub FadeForm (TheForm As Form)
Dim FormHeight%, Blue%, StepInterval%, X%, RetVal%, OldMode%
Dim FillArea As RECT
OldMode = TheForm.ScaleMode
TheForm.ScaleMode = 3 'Pixel
FormHeight = TheForm.ScaleHeight
' Divide the form into 63 regions
StepInterval = FormHeight \ 63
Blue = 255
FillArea.Left = 0
FillArea.Right = TheForm.ScaleWidth
FillArea.Top = 0
FillArea.Bottom = StepInterval
For X = 1 To 63
hBrush% = CreateSolidBrush(RGB(0, 0, Blue))
RetVal% = FillRect(TheForm.hDC, FillArea, hBrush)
RetVal% = DeleteObject(hBrush)
Blue = Blue - 4
FillArea.Top = FillArea.Bottom
FillArea.Bottom = FillArea.Bottom + StepInterval
Next
' Fill the remainder of the form with black
FillArea.Bottom = FillArea.Bottom + 63
hBrush% = CreateSolidBrush(RGB(0, 0, 0))
RetVal% = FillRect(TheForm.hDC, FillArea, hBrush)
RetVal% = DeleteObject(hBrush)
TheForm.ScaleMode = OldMode
End Sub